package glickrdemo

import org.glickr.FlickrServiceException
import org.glickr.FlickrPeople

class PeopleController {
    def flickrService

    def index() {
        redirect(action:'getPeople')
    }

    def getPeople() {
        def examples = []

        examples.add([ method:'getPeopleById',       params:'86869926@N02',      result:flickrService.getPeopleById('86869926@N02') ])
        examples.add([ method:'getPeopleByUsername', params:'glickr.org',        result:flickrService.getPeopleByUsername('glickr.org') ])
        examples.add([ method:'getPeopleByEmail',    params:'edwin@glickr.org',  result:flickrService.getPeopleByEmail('edwin@glickr.org') ])

        [examples: examples]
    }

    def getPeoplePublicPhotos() {
        def examples = []

        examples.add( [ method:'getPeoplePublicPhotos',           params:'FlickrPeople',      result:flickrService.getPeoplePublicPhotos(new FlickrPeople(nsid:'86869926@N02')) ])
        examples.add( [ method:'getPeoplePublicPhotosById',       params:'86869926@N02',      result:flickrService.getPeoplePublicPhotosById('86869926@N02') ])
        examples.add( [ method:'getPeoplePublicPhotosByUsername', params:'glickr.org',        result:flickrService.getPeoplePublicPhotosByUsername('glickr.org') ])
        examples.add( [ method:'getPeoplePublicPhotosByEmail',    params:'edwin@glickr.org',  result:flickrService.getPeoplePublicPhotosByEmail('edwin@glickr.org') ])

        [examples: examples]
    }
}
